package com.wenge.datagroup.storage.future

import com.wenge.datagroup.storage.dataprocess.{MultilingualLanguage, MultilingualTranslation}
import com.wenge.datagroup.storage.util.DruidDataSource
import org.apache.spark.broadcast.Broadcast

/**
 * @author
 *   Depp
 */
class AsyncProcessCreater(createAsyncProcess: () => AsyncProcess) {
  lazy val asyncProcess: AsyncProcess = createAsyncProcess()
}

object AsyncProcessCreater {
  def apply(
      druidDataSourceBro: Broadcast[DruidDataSource],
      multilingualLanguageBro: Broadcast[MultilingualLanguage],
      multilingualTranslationBro: Broadcast[MultilingualTranslation]): AsyncProcessCreater = {
    val createAsyncProcessFunc = () => {
      new AsyncProcess(druidDataSourceBro, multilingualLanguageBro, multilingualTranslationBro)
    }
    new AsyncProcessCreater(createAsyncProcessFunc)
  }
}
